import 'package:flutter/material.dart';
import 'package:flutterdemo/components/button.dart';

class Reg extends StatefulWidget {
  Reg({Key? key}) : super(key: key);
  @override
  _RegState createState() => _RegState();
}

class _RegState extends State<Reg> {
  Widget inputWidget(String text, Widget icon, String hintText) {
    return Container(
      child: TextField(
        maxLines:1,
        decoration: InputDecoration(
          labelText: text,
          hintText: hintText,
          icon: icon
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: const Text("账号注册"),
        ),
        body: Container(
            padding: EdgeInsets.only(left: 20, right: 20),
            decoration: const BoxDecoration(
                image: DecorationImage(
                    image: NetworkImage(
                      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fce816130cc5a9084a12f6a3b3e7669702b8459d918559-T3q6uE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1642572233&t=1441e1bebd15f6739f0ce9fbf1a1d7ff",
                    ),
                    fit: BoxFit.cover)),
            child: Center(
              child: Container(
                padding: const EdgeInsets.all(20),
                decoration: const BoxDecoration(
                  color: Color.fromRGBO(255, 255, 255, 0.6),
                  borderRadius: BorderRadius.all(Radius.circular(4.0))
                ),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    inputWidget("账号", const Icon(Icons.settings), "请输入账号"),
                    const SizedBox(height: 10,),
                    inputWidget("密码", const Icon(Icons.settings), "请输入密码"),
                    const SizedBox(height: 10,),
                    inputWidget("邀请码", const Icon(Icons.settings), "请输入密码"),
                    const SizedBox(height: 10,),
                    MyButton("立即注册",width:double.infinity,onPressed: (){},)
                  ],
                ),
              ),
            ))
          );

  }
}
